class MaquinaVirtualsController < ApplicationController
  # GET /maquina_virtuals
  # GET /maquina_virtuals.json
  def index
    @maquina_virtuals = MaquinaVirtual.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @maquina_virtuals }
    end
  end

  # GET /maquina_virtuals/1
  # GET /maquina_virtuals/1.json
  def show
    @maquina_virtual = MaquinaVirtual.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @maquina_virtual }
    end
  end

  # GET /maquina_virtuals/new
  # GET /maquina_virtuals/new.json
  def new
    @maquina_virtual = MaquinaVirtual.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @maquina_virtual }
    end
  end

  # GET /maquina_virtuals/1/edit
  def edit
    @maquina_virtual = MaquinaVirtual.find(params[:id])
  end

  # POST /maquina_virtuals
  # POST /maquina_virtuals.json
  def create
    @maquina_virtual = MaquinaVirtual.new(params[:maquina_virtual])

    respond_to do |format|
      if @maquina_virtual.save
        format.html { redirect_to @maquina_virtual, notice: 'Maquina virtual was successfully created.' }
        format.json { render json: @maquina_virtual, status: :created, location: @maquina_virtual }
      else
        format.html { render action: "new" }
        format.json { render json: @maquina_virtual.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /maquina_virtuals/1
  # PUT /maquina_virtuals/1.json
  def update
    @maquina_virtual = MaquinaVirtual.find(params[:id])

    respond_to do |format|
      if @maquina_virtual.update_attributes(params[:maquina_virtual])
        format.html { redirect_to @maquina_virtual, notice: 'Maquina virtual was successfully updated.' }
        format.json { head :ok }
      else
        format.html { render action: "edit" }
        format.json { render json: @maquina_virtual.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /maquina_virtuals/1
  # DELETE /maquina_virtuals/1.json
  def destroy
    @maquina_virtual = MaquinaVirtual.find(params[:id])
    @maquina_virtual.destroy

    respond_to do |format|
      format.html { redirect_to maquina_virtuals_url }
      format.json { head :ok }
    end
  end
end
